{% extends "main.html" %}


{% block head %}
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools-yui-compressed.js"></script>
<script src="/static/growl1.1.js" type="text/javascript"></script>

<script type="text/javascript">
		
	window.addEvent('domready', function(){
		{% if post.comments_enabled %}
		$('commentform').reset();

		$('commentform').addEvent('submit', function(e) {
			new Event(e).stop();

			var log = $('load_img').setStyles({'display':'inline'});

		   this.send({
				evalScripts: true,
				onComplete: function() {
					log.setStyles({'display':'none'});
				}
			});
		});

		{% endif %}
		
		});
</script>
{% endblock %}

{% block content %}

{{ content }}

{% if not post %}
	<h2>Ningún post seleccionado</h2>
{% else %}


<div class="post">
	<h2 class="title"><a href="/post/{{ post.permalink }}">{{ post.title }}</a></h2>
	<div class="entry">
		{% if post.excerpt %}<h3>{{ post.excerpt }}</h3>{% endif %}
		{{ post.content|linebreaks }}
	</div>
	<p class="meta">Publicado en {{ post.published|date:"d/m/Y H:i"}} &nbsp;|&nbsp; {% for cat in post.categories %}
		<a href="/category/{{ cat.category_url}}">{{ cat.category_name }}</a>
		{% endfor %} &nbsp;|&nbsp; <a href="/post/{{ post.permalink }}/#comments">{{ post.num_comments }} comentario{{ post.num_comments|pluralize }}</a>{% if user %} | <a href="/admin/posts/edit?id={{ post.key }}" class="edit">Edit</a> {% endif %}</p>
</div>
	
{% endif %}

<div id="comments">

{% if comments.count %}
	<h3>Comentarios</h3>
{% else %}
	<h3>No hay comentarios</h3>
{% endif %}

<ul id="comment_list">
	
{% for com in comments  %}

<li class="alt">
		<div class="comment_info">
			<span class="author">{% if com.link %}
				<a href="{{ com.link }}">{{ com.author }}</a>
				{% else %}
					{{ com.author }}
				{% endif %}</span><em> | <span class="date">{{ com.date|date:"d/m/Y H:i" }}</span></em>
		</div>
		{{ com.text|linebreaks }}		

</li>

{% endfor %}
</ul>

{% if post.comments_enabled %}

<h3 id="respond">Deja un comentario!</h3>


<form action="/comment" method="post" id="commentform">
<p><!--<input class="textbox" name="author" id="author" value="" size="22" tabindex="1" type="text">-->
{{form.author}}
<label for="author"><small>Nombre (requerido)</small></label></p>

<p><!--<input class="textbox" name="email" id="email" value="" size="22" tabindex="2" type="text">-->
{{form.email}}
<label for="email"><small>Mail (requirido	)</small></label></p>

<p><!--<input class="textbox" name="url" id="url" value="" size="22" tabindex="3" type="text">-->
{{form.link}}
<label for="url"><small>Web</small></label></p>

<p><!--<textarea name="comment" id="comment" cols="80" rows="10" tabindex="4"></textarea></p>-->
{{form.text}}

<p>
  <input name="submit" id="submit" tabindex="5" value="Send Comment	" type="submit">
  <input name="post_key" value="{{key}}" type="hidden"><img src="/static/images/loading.gif" style="display:none;" id="load_img" />
</p>

</form>

{% else %}
<!--<h3 id="respond">Comentarios cerrados</h3>-->
{% endif %}
</div>


{% endblock %}
